package cn.edu.neusoft.maxingxin231.yuejian06.Activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import cn.edu.neusoft.maxingxin231.yuejian06.R;

public class DetailActivity extends BaseActivity {
    Context context;
    String name,pic,address,data,enroll,cost,aid,price;
    String hotline;
    TextView tv_name,tv_address,tv_hotline,tv_intro;
    ImageButton imgbtn_return,imgbtn_collect;
    ImageView img_activity;
    Button btn_apply;
    @Override
    void initView() {
        setLayout_file(R.layout.activity_detail);
        imgbtn_return = (ImageButton)findViewById(R.id.imgbtn_return);
        imgbtn_collect = (ImageButton)findViewById(R.id.imgbtn_collect);
        tv_name = (TextView)findViewById(R.id.tv_name);
        tv_address = (TextView)findViewById(R.id.tv_address);
        tv_hotline = (TextView)findViewById(R.id.tv_hotline);
        tv_intro = (TextView)findViewById(R.id.tv_intro);
        img_activity=(ImageView)findViewById(R.id.img_activity);
        btn_apply=(Button)findViewById(R.id.btn_apply);

//        train_id = getIntent().getStringExtra("train_id");
//        getIntent().getStringExtra("aid",aid);
        hotline=getIntent().getStringExtra("hotline");
        name=getIntent().getStringExtra("name");
        address=getIntent().getStringExtra("address");
        pic=getIntent().getStringExtra("pic");
//        getIntent().getStringExtra("data",data);
        enroll=getIntent().getStringExtra("enroll");
//        getIntent().getStringExtra("cost",cost);
        price=getIntent().getStringExtra("price");

        tv_name.setText(name);
        tv_address.setText(address);
        Picasso.with(DetailActivity.this).load("http://10.0.2.2:80/yuejian14/public/static/images/"+pic).into(img_activity);
        showToast(name);
    }

    @Override
    void initEvent() {
        imgbtn_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        //报名按钮
        btn_apply.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(DetailActivity.this,ApplyActivity.class);
                intent.putExtra("price",price);
                startActivityForResult(intent,1);

            }
        });
    }

    @Override
    void initData() {

    }

    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {

    }
}
